package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysDictData;
import com.ruoyi.system.api.domain.SysRegion;
import com.ruoyi.system.api.factory.RemoteCommonFallbackFactory;
import com.ruoyi.system.api.domain.SysDatascope;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient(contextId = "remoteCommonService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteCommonFallbackFactory.class)
public interface RemoteCommonService{

	 @GetMapping("/region/list")
	 public TableDataInfo<SysRegion> getRegionList(
			 	@RequestParam("name") String name,
			 	@RequestParam("parentId") Long parentId,
				@RequestParam("level") String level,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

	@GetMapping("/region/getListByIds")
	List<SysRegion> regionInfo(@RequestParam("ids") Set<String> ids, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


	@GetMapping("/dict/data/list")
	 public TableDataInfo<SysDictData> getDictList(
			 	@RequestParam("dictType") String dictType,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
	 
	 @GetMapping("/dept/list")
	 public TableDataInfo<SysDept> getSysDeptList(
			 	@RequestParam("tenantId") Long tenantId,
			 	@RequestParam("parentId") Long parentId,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
	 
	 @PostMapping("/dict/data")
	 public TableDataInfo<SysDept> addSysDictData(
			 	@RequestBody SysDictData sysDictData,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
	 
	 
	 @GetMapping("/dept/{deptId}")
	 public SysDept getSysDeptById(
			 	@PathVariable("deptId") Long deptId,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
	 
	 @PutMapping("/dept")
	 public SysDept editSysDeptById(
			 	@RequestParam("deptId") Long deptId,
			 	@RequestParam("leader") String leader,
			 	@RequestParam("phone") String phone,
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
	 
	 @GetMapping("/datascope/all")
	 public List<SysDatascope> listAll(
				@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
